import threading
import time


def music(n):
    for i in range(n):
        print('正在听音乐。。。')
        time.sleep(1)

def coding(t):
    for i in range(3):
        print('正在写代码。。。')
        time.sleep(t)

if __name__ == '__main__':
    # 通过多线程完成多任务
    music_thread = threading.Thread(target=music,args=(3,))
    coding_thread = threading.Thread(target=coding,kwargs={'t':1})
    music_thread.start()
    coding_thread.start()
